package homeWork;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

public class Test3 {//   张三,男,20,88
    public static void main(String[] args) throws IOException {
        List<Student> stuList = new ArrayList<>();
        stuList.add(new Student("张三","男",20,88));
        stuList.add(new Student("李四","女",19,99));
        FileOutputStream fos = new FileOutputStream("D:\\a\\a.txt");
        for (Student student : stuList) {
            String stu = student.getName()+","+student.getSex()+","+student.getAge()+","+student.getScore()+"\r";
            byte[] bytes = stu.getBytes();
            fos.write(bytes);
        }
    }
}
